package com.ncs.controller;

import com.ncs.pojo.Stuff;
import com.ncs.service.StuffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController

public class StuffController {

    @Autowired
    StuffService stuffService;

    @GetMapping("/stuff/findList")
    public List<Stuff> findList(){
        List<Stuff> stuffs = stuffService.findList();
        return stuffs;
    }

    @GetMapping("/stuff/findOne")
    public Stuff findOne(Integer id){
        Stuff stuff = stuffService.findOne(id);
        return stuff;
    }

    @GetMapping("/stuff/addOne" )
    public void  addOne(Stuff stuff){
        stuffService.addOne(stuff);
    }

    @GetMapping("/stuff/updateOne")
    public void updateOne(Stuff stuff){
        stuffService.updateOne(stuff);
    }

    @GetMapping("/stuff/delOne")
    public void delOne(Integer id){
        stuffService.delOne(id);
    }
}
